

<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title></title>
	<link rel="stylesheet"/>
	<link rel="stylesheet" href="css/Site.css"/>
	<link rel="stylesheet" href="css/zy.all.css"/>
	<link rel="stylesheet" href="css/font-awesome.min.css"/>
	<link rel="stylesheet" href="css/amazeui.min.css"/>
	<link rel="stylesheet" href="css/admin.css"/>
</head>

<body>
<div class="dvcontent">

	<div>
		<!--tab start-->
		<div class="tabs" style="margin: 30px;">
			<div class="hd">
				<ul>
					<li class="on" id="good" style="box-sizing: initial;-webkit-box-sizing: initial;">库存查询</li>
					<li class="" id="supply" style="box-sizing: initial;-webkit-box-sizing: initial;">库存警报</li>
					<li class="" id="customer" style="box-sizing: initial;-webkit-box-sizing: initial;">预警设置</li>
				</ul>
			</div>
			<div class="bd">
				<!--查询-->
				<ul style="display: block;padding: 20px;">
					<li>
						<!--分页显示角色信息 start-->
						<div id="dv1">
							<table class="table" id="goodRecord">
								<thead>
								<tr>
									<th>编号</th>
									<th>商品名称</th>
									<th>库存量</th>
									<th>编辑</th>
									<th>清除</th>
								</tr>
								</thead>
								<tbody>
								<tr>
									<td><%= gd.getGoods_id() %>
									</td>
									<td><%= gd.getGood_name() %>
									</td>
									<td><%= gd.getGood_quantity() %>
									</td>
									<td class="edit">
										<button onclick="btn_goodstockedit(1)"><i
												class="icon-edit bigger-120"></i>修改库存
										</button>
									</td>
									<td class="delete">
										<button onclick="btn_goodstockdelete(1)"><i
												class="icon-trash bigger-120"></i>清除库存
										</button>
									</td>
								</tr>
								<%
								}
								%>

								</tbody>

							</table>
						</div>
						<!--分页显示角色信息 end-->
					</li>
				</ul>

				<!--警报-->

				<ul style="display: none;padding: 20px;">
					<li>
						<!--分页显示角色信息 start-->
						<div>
							<table class="table">
								<thead>
								<tr>
									<th>编号</th>
									<th>商品名称</th>
									<th>库存量</th>
									<th>预警下限</th>
								</tr>
								</thead>
								<tbody>
								<%
								ArrayList gl1 = DB.findgoodstockwarningInfo();
								Iterator iter1 = gl1.iterator();
								while (iter1.hasNext()) {
								good gd = (good) iter1.next();
								%>

								<tr>
									<td><%= gd.getGoods_id() %>
									</td>
									<td><%= gd.getGood_name() %>
									</td>
									<td><%= gd.getGood_quantity() %>
									</td>
									<td><%= gd.getlowerLimit() %>
									</td>
								</tr>
								<%
								}
								%>

								</tbody>

							</table>
						</div>
						<!--分页显示角色信息 end-->
					</li>
				</ul>


				<!--预警设置-->

				<ul style="display: none;padding: 20px;">
					<li>
						<!--分页显示角色信息 start-->
						<div id="dv3">
							<table class="table">
								<thead>
								<tr>
									<th>编号</th>
									<th>商品名称</th>
									<th>预警下限</th>
									<th>编辑预警</th>
									<th>清除预警</th>
								</tr>
								</thead>
								<tbody>

								<tr>
									<td><%= gd.getGoods_id() %>
									</td>
									<td><%= gd.getGood_name() %>
									</td>
									<td><%= gd.getlowerLimit() %>
									</td>
									<td class="edit">
										<button onclick="btn_goodstockwarningedit(1)"><i
												class="icon-edit bigger-120"></i>修改预警
										</button>
									</td>
									<td class="delete">
										<button onclick="btn_goodstockwarningdelete(1)"><i
												class="icon-trash bigger-120"></i>预警清零
										</button>
									</td>
								</tr>
								<%
								}
								%>

								</tbody>

							</table>
						</div>
						<!--分页显示角色信息 end-->
					</li>
				</ul>


				<!--tab end-->

			</div>


			<script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
			<script src="js/plugs/Jqueryplugs.js" type="text/javascript"></script>
			<script src="js/_layout.js"></script>
			<script src="js/plugs/jquery.SuperSlide.source.js"></script>
			<script>
				window.onload = function () {

				}
				var num = 1;
				$(function () {

					$(".tabs").slide({trigger: "click"});

				});


				var btn_save = function () {
					var pid = $("#RawMaterialsTypePageId  option:selected").val();
					var name = $("#RawMaterialsTypeName").val();
					var desc = $("#RawMaterialsTypeDescription").val();
					var ramark = $("#Ramark").val();
					$.ajax({
						type: "post",
						url: "/RawMaterialsType/AddRawMaterialsType",
						data: {name: name, pid: pid, desc: desc, ramark: ramark},
						success: function (data) {
							if (data > 0) {
								$.jq_Alert({
									message: "添加成功",
									btnOktext: "确认",
									dialogModal: true,
									btnOkClick: function () {
										//$("#RawMaterialsTypeName").val("");
										//$("#RawMaterialsTypeDescription").val("");
										//$("#Ramark").val("");
										//page1();
										location.reload();

									}
								});
							}
						}
					});
					alert(t);
				}


				var btn_goodstockedit = function (goodid) {
					$.jq_Panel({
						message: "<div class=\"admin-content\">\n" +
								"                                <div class=\"admin-content-body\">\n" +
								"\n" +
								"                                    <div class=\"am-g\">\n" +
								"                                        <div class=\"am-u-sm-12 am-u-md-4 am-u-md-push-8\">\n" +
								"\n" +
								"                                        </div>\n" +
								"                                        <div class=\"am-u-sm-12 am-u-md-8 am-u-md-pull-4\" style=\"padding-top: 30px;\">\n" +
								"                                            <form class=\"am-form am-form-horizontal\" action=\"/test_war/editgoodstock\"\n" +
								"                                                  method=\"post\">\n" +
								"                                                <input type=\"text\" id=\"goodid\" name=\"goodid\" value=\""+goodid+"\" style=\"display: none\">\n" +
								"\n" +
								"                                                <div class=\"am-form-group\">\n" +
								"                                                    <label class=\"am-u-sm-3 am-form-label\">\n" +
								"                                                        商品编号</label>\n" +
								"                                                    <div class=\"am-u-sm-9\">\n" +
								"                                                        <input type=\"text\" value=\""+goodid+"\" readonly=\"readonly\">\n" +
								"                                                        <small>要修改的商品编号</small>\n" +
								"                                                    </div>\n" +
								"                                                </div>\n" +
								"\n" +
								"                                                <div class=\"am-form-group\">\n" +
								"                                                    <label class=\"am-u-sm-3 am-form-label\">\n" +
								"                                                        库存量</label>\n" +
								"                                                    <div class=\"am-u-sm-9\">\n" +
								"                                                        <input type=\"text\" id=\"goodamount\" required\n" +
								"                                                               placeholder=\"请输入修改的库存数量\" name=\"goodamount\">\n" +
								"                                                        <small>输入正整数</small>\n" +
								"                                                    </div>\n" +
								"                                                </div>\n" +
								"\n" +
								"                                                <div class=\"am-form-group\">\n" +
								"                                                    <div class=\"am-u-sm-9 am-u-sm-push-3\">\n" +
								"                                                        <input type=\"submit\" class=\"am-btn am-btn-success\"\n" +
								"                                                               value=\"确认修改\"/>\n" +
								"                                                    </div>\n" +
								"                                                </div>\n" +
								"                                            </form>\n" +
								"                                        </div>\n" +
								"                                    </div>\n" +
								"                                </div>\n" +
								"                                <footer class=\"admin-content-footer\">\n" +
								"                                    <hr>\n" +
								"                                    <p class=\"am-padding-left\"></p>\n" +
								"                                </footer>\n" +
								"                            </div>",
						title: "编辑商品",
						dialogModal: true,
						iframeWidth: 500,
						iframeHeight: 400
					});
				}

				var btn_goodstockdelete = function (goodid) {
					$.jq_Confirm({
						message: "您确定要将库存清零吗?",
						btnOkClick: function () {
							var request = new XMLHttpRequest();
							let params = "goodid=" + encodeURIComponent(goodid)
									+"&goodamount="+encodeURIComponent(0);
							request.open("post", "/test_war/editgoodstock", true);
							request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
							request.send(params);

							request.onreadystatechange = function () {

									window.history.go();
						}
					}
				});
				}

				var btn_goodstockwarningedit = function (goodid) {
					$.jq_Panel({
						url: "/RawMaterialsType/EditRawMaterialsType?id=" + id,
						message: "<div class=\"admin-content\">\n" +
								"                                <div class=\"admin-content-body\">\n" +
								"\n" +
								"                                    <div class=\"am-g\">\n" +
								"                                        <div class=\"am-u-sm-12 am-u-md-4 am-u-md-push-8\">\n" +
								"\n" +
								"                                        </div>\n" +
								"                                        <div class=\"am-u-sm-12 am-u-md-8 am-u-md-pull-4\" style=\"padding-top: 30px;\">\n" +
								"                                            <form class=\"am-form am-form-horizontal\" action=\"/test_war/editgoodstockwarning\"\n" +
								"                                                  method=\"post\">\n" +
								"                                                <input type=\"text\" id=\"goodid\" name=\"goodid\" value=\""+goodid+"\" style=\"display: none\">\n" +
								"\n" +
								"                                                <div class=\"am-form-group\">\n" +
								"                                                    <label class=\"am-u-sm-3 am-form-label\">\n" +
								"                                                        商品编号</label>\n" +
								"                                                    <div class=\"am-u-sm-9\">\n" +
								"                                                        <input type=\"text\" value=\""+goodid+"\" readonly=\"readonly\">\n" +
								"                                                        <small>要修改的商品编号</small>\n" +
								"                                                    </div>\n" +
								"                                                </div>\n" +
								"\n" +
								"                                                <div class=\"am-form-group\">\n" +
								"                                                    <label class=\"am-u-sm-3 am-form-label\">\n" +
								"                                                        预警下限</label>\n" +
								"                                                    <div class=\"am-u-sm-9\">\n" +
								"                                                        <input type=\"text\" id=\"goodamount\" required\n" +
								"                                                               placeholder=\"请输入修改的预警下限\" name=\"goodamount\">\n" +
								"                                                        <small>输入正整数</small>\n" +
								"                                                    </div>\n" +
								"                                                </div>\n" +
								"\n" +
								"                                                <div class=\"am-form-group\">\n" +
								"                                                    <div class=\"am-u-sm-9 am-u-sm-push-3\">\n" +
								"                                                        <input type=\"submit\" class=\"am-btn am-btn-success\"\n" +
								"                                                               value=\"确认修改\"/>\n" +
								"                                                    </div>\n" +
								"                                                </div>\n" +
								"                                            </form>\n" +
								"                                        </div>\n" +
								"                                    </div>\n" +
								"                                </div>\n" +
								"                                <footer class=\"admin-content-footer\">\n" +
								"                                    <hr>\n" +
								"                                    <p class=\"am-padding-left\"></p>\n" +
								"                                </footer>\n" +
								"                            </div>",
						title: "编辑商品",
						dialogModal: true,
						iframeWidth: 500,
						iframeHeight: 400
					});
				}

				var btn_goodstockwarningdelete = function (goodid) {
					$.jq_Confirm({
						message: "您确定要将预警下限清零吗?",
						btnOkClick: function () {
							var request = new XMLHttpRequest();
							let params = "goodid=" + encodeURIComponent(goodid)
									+"&goodamount="+encodeURIComponent(0);
							request.open("post", "/test_war/editgoodstockwarning", true);
							request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
							request.send(params);

							request.onreadystatechange = function () {
										if(request.readyState==4)location.reload();

						}
					}
				});
				}

			</script>

		</div>
	</div>
</div>
</body>

</html>